<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="example">
        <div>{{date | format('yyyy-MM-dd')}}</div>
        <div>{{ message | capitalize }}---{{ msg | capitalize }}</div>
    </div>

    <script src="../../js/vue.js"></script>
    <script>
        Vue.filter("format", function (value, arg) {
            // console.log('~~', value, arg)
            if (arg == "yyyy-MM-dd") {
                ret = value.getFullYear() + '-' + (value.getMonth() + 1) + '-' + value.getDate();
                return ret;
            }
            return value
        })

        var vm = new Vue({
            el: '#example',
            data: {
                date: new Date(),
                msg: "hello"
            },
            filters: {
                capitalize: function (value) {
                    if (!value) return ''
                    value = value.toString()
                    return value.charAt(0).toUpperCase() + value.slice(1)
                }
            }
        })

        console.log('data', vm.$data)
    </script>
</body>

</html>